import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    name: "layout",
    redirect: "/layout",
  }, {
    path: "/layout",
    name: "layout",
    component: () => import("@/views/layout/index.vue"),
    children: [
      {
        path: "/layout",
        redirect: "/home",
        meta: { hiddren: true }
      }, {
        path: "/home",
        name: "home",
        meta: { title: "首页", icon: "wap-home-o" },
        component: () => import("@/views/home/index.vue"),
      }, {
        path: "/list",
        name: "list",
        meta: { title: "列表", icon: "apps-o" },
        component: () => import("@/views/list/index.vue"),
      }, {
        path: "/car",
        name: "car",
        meta: { title: "购物车", icon: "shopping-cart-o" },
        component: () => import("@/views/car/index.vue"),
      }, {
        path: "/my",
        name: "my",
        meta: { title: "我的", icon: "user-o" },
        component: () => import("@/views/my/index.vue"),
      }
    ]
  }, {
    path: "/login",
    name: "login",
    component: () => import("@/views/login/index.vue"),
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
